package gui;

import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;

public class AddUser extends JPanel {

	private JButton btnCancel;
	private JButton btnContinue;
	private JRadioButton rdbtnAdmin;
	private JRadioButton rdbtnUser;
	private JTextField username;
	private JTextField password;
	private JTextField balance;
	private JLabel lblAddUser;
	private final ButtonGroup buttonGroup = new ButtonGroup();
	/**
	 * Create the panel.
	 */
	public AddUser() {
		setLayout(null);
		
		lblAddUser = new JLabel("Add User");
		lblAddUser.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblAddUser.setBounds(193, 13, 63, 17);
		add(lblAddUser);

		JLabel lblUsername = new JLabel("Username: ");
		lblUsername.setBounds(65, 67, 79, 16);
		add(lblUsername);

		JLabel lblPassword = new JLabel("Password:");
		lblPassword.setBounds(65, 98, 79, 16);
		add(lblPassword);

		JLabel lblStartingBalance = new JLabel("Balance: ");
		lblStartingBalance.setBounds(65, 127, 79, 16);
		add(lblStartingBalance);

		rdbtnUser = new JRadioButton("Regular User");
		rdbtnUser.addItemListener(new RdbtnUserItemListener());
		buttonGroup.add(rdbtnUser);
		rdbtnUser.setBounds(65, 161, 103, 25);
		add(rdbtnUser);

		rdbtnAdmin = new JRadioButton("Admin");
		rdbtnAdmin.addItemListener(new RdbtnAdminItemListener());
		buttonGroup.add(rdbtnAdmin);
		rdbtnAdmin.setBounds(179, 161, 65, 25);
		add(rdbtnAdmin);

		
		btnCancel = new JButton("Back");
		btnCancel.setBounds(58, 207, 92, 25);
		add(btnCancel);

		btnContinue = new JButton("Continue");
		btnContinue.setBounds(291, 207, 92, 25);
		add(btnContinue);

		JLabel lblcbsdk = new JLabel("Remember @-sign");
		lblcbsdk.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
		lblcbsdk.setBounds(275, 69, 87, 14);
		add(lblcbsdk);

		JLabel lblMinCharacters = new JLabel("Min. 6 characters");
		lblMinCharacters.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
		lblMinCharacters.setBounds(275, 100, 82, 14);
		add(lblMinCharacters);

		JLabel lblStartingBalance_1 = new JLabel("Starting balance");
		lblStartingBalance_1.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
		lblStartingBalance_1.setBounds(275, 129, 79, 14);
		add(lblStartingBalance_1);
		
		username = new JTextField();
		username.setBounds(147, 64, 116, 22);
		add(username);
		username.setColumns(10);
		
		password = new JTextField();
		password.setColumns(10);
		password.setBounds(147, 95, 116, 22);
		add(password);
		
		balance = new JTextField();
		balance.setColumns(10);
		balance.setBounds(147, 124, 116, 22);
		add(balance);
	}
	
	public void addActionListener(ActionListener l) {
		btnCancel.addActionListener(l);
		btnContinue.addActionListener(l);
		rdbtnAdmin.addActionListener(l);
		rdbtnUser.addActionListener(l);
		
	}
	public JButton getBtnCancel() {
		return btnCancel;
	}
	public JButton getBtnContinue() {
		return btnContinue;
	}
	public JRadioButton getRdbtnAdmin() {
		return rdbtnAdmin;
	}
	public JTextField getUsername() {
		return username;
	}
	public JTextField getPassword() {
		return password;
	}
	public JTextField getBalance() {
		return balance;
	}
	public JLabel getLblAddUser() {
		return lblAddUser;
	}
	private class RdbtnUserItemListener implements ItemListener {
		public void itemStateChanged(ItemEvent arg0) {
		}
	}
	private class RdbtnAdminItemListener implements ItemListener {
		public void itemStateChanged(ItemEvent e) {
		}
	}
}
